<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增</title>
    <link href="{{ url_for('static', filename = 'css/bootstrap.min.css') }}" rel="stylesheet">
    <style>
      body {
        padding-top: 30px;
        background-color: #f8f9fa;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      }
      .form-container {
        max-width: 500px;
        margin: 0 auto;
      }
      .card {
        border: none;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        transition: all 0.3s ease;
      }
      .card-header {
        background-color: #4a6fa5;
        color: white;
        border-radius: 10px 10px 0 0 !important;
        padding: 12px 20px; /* 减少头部内边距，降低高度 */
        font-size: 1.1rem;
        font-weight: 500;
      }
      .card-body {
        padding: 18px 20px; /* 减少主体内边距，降低高度 */
      }
      .form-group {
        margin-bottom: 15px; /* 减少表单组间距 */
      }
      label {
        font-weight: 500;
        margin-bottom: 5px; /* 减少标签下边距 */
        color: #495057;
      }
      .form-control {
        border-radius: 6px;
        border: 1px solid #e2e8f0;
        padding: 6px 12px; /* 减少输入框内边距，降低高度 */
        height: 36px; /* 降低输入框高度 */
        transition: border-color 0.2s, box-shadow 0.2s;
      }
      .form-check {
        padding-left: 15%;
      }
      .form-check-input {
        margin-right: 6px; /* 减少单选框与标签间距 */
      }
      .gender-radio {
        display: flex; /* 使用flex布局优化排列 */
        gap: 15px; /* 调整性别选项间距 */
      }
      .btn {
        border-radius: 6px;
        padding: 6px 14px; /* 减少按钮内边距，降低高度 */
        font-weight: 500;
        transition: all 0.2s ease;
      }
      .alert {
        margin: 10px 0; /* 减少提示信息间距 */
        padding: 10px;
        border-radius: 6px;
        font-size: 0.9rem;
      }
    </style>
  </head>
  <body>
    <div class="form-container">
      <div class="card">
        <div class="card-header">
          新增用户
        </div>
        <div class="card-body">
          <form action="/add" method="post">
            <!-- 姓名输入框 -->
            <div class="form-group">
              <label for="name">姓名</label>
              <input type="text" class="form-control" id="name" name="name" required>
            </div>

            <!-- 年龄输入框 -->
            <div class="form-group">
              <label for="age">年龄</label>
              <input type="text" class="form-control" id="age" name="age" required>
            </div>

            <!-- 性别选择 -->
            <div class="form-group">
              <label>性别</label>
              <div class="gender-radio"> <!-- 使用自定义容器优化布局 -->
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="gender" id="gender01" value="男" checked>
                  <label class="form-check-label" for="gender01">男</label>
                </div>
                <div class="form-check">
                  <input class="form-check-input" type="radio" name="gender" id="gender02" value="女">
                  <label class="form-check-label" for="gender02">女</label>
                </div>
              </div>
            </div>

            <!-- 联系电话输入框 -->
            <div class="form-group">
              <label for="phone">联系电话</label>
              <input type="text" class="form-control" id="phone" name="phone" required>
            </div>

            <!-- 按钮区域 -->
            <div class="form-group mt-3 text-center"> <!-- 减少按钮区域上边距 -->
              <button type="button" class="btn btn-secondary me-2" onclick="window.location.href='/'" style="min-width: 90px;">
                取消
              </button>
              <button type="submit" class="btn btn-primary" style="min-width: 90px;">
                保存
              </button>
            </div>
          </form>
        </div>

        <!-- 提示信息 -->
        {% if success %}
        <div class="alert alert-warning mx-4 mb-3" role="alert">
          {{ success }}
        </div>
        {% endif %}
      </div>
    </div>
  </body>
</html>